<? FoundryView::includeTpl( 'adminMain:header' ) ?>

<script type="text/javascript" src="<?=Foundry::config('webpath')?>/javascript/admin/tagRules.js"></script>


<div id="mainContent">

	<h2>Categories</h2>
	
	<a href="#" class="actionLink" id="showNewTag">
		<img src="<?=Foundry::config('webpath')?>/images/admin/add.png" />
		new tag</a>
	<span id="actionMessage"></span>
	<p />
	
	<div id="newTagContainer" style="display: none;">
		<form method="post" action="<?=FoundryView::helperLinkTo( 'tagAdmin/newTag' )?>">
		<input type="text" name="tagName" value="Tag Name" onfocus="this.value=''" />
		<input type="submit" value="Add Tag" />
		</form>
	</div>
		
	<?php
		$mTag = FoundryController::model( 'tag' );
		$tags = $mTag->find( 'order by *name asc' );		
	?>
		
	<ul class="assetList">
	<? foreach( $tags as $tag ) : ?>
	
		<li id="tagContainer<?=$tag->uid?>">
			<img src="<?=Foundry::config('webpath')?>/images/admin/cross.png" title="Delete this tag" class="tagDelete" for="<?=$tag->uid?>" />
			<img src="<?=Foundry::config('webpath')?>/images/admin/pencil.png" title="Edit this tag" class="tagEdit" for="<?=$tag->uid?>"/>
			<span id="tagNameContainer<?=$tag->uid?>"><?=$tag->name?></span>
		</li>
		<li id="infoBumper<?=$tag->uid?>" style="display: none"></li>
	
	<? endforeach ?>
	</ul>
	
</div>

<? FoundryView::includeTpl( 'adminMain:footer' ) ?>